package com.mv.springmvc;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mv.spring.bean.BeanFactory;
import com.mv.spring.core.ClassScanner;
import com.mv.springmvc.controller.UserController;
public class ProxyTest {
    private static final Logger log = LoggerFactory.getLogger(ProxyTest.class);
	  public static void main(String[] args) {
          log.info("spring 扫描类 scannerCLasses");
          List<Class<?>> classList = new ClassScanner().scannerCLasses(ProxyTest.class.getPackage().getName());
          log.info("spring 扫描类列表:" +  classList.toString());
          // 初始化 Bean 工厂,初始化 AOP，这里使用了 JDK 动态代理，
          // Bean工厂第一次初始化后，使用代理类的对象来覆盖 Bean 工厂中的对应对象
          log.info("spring 注册对象 initBean" );
          try {
			BeanFactory.initBean(classList);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
          log.info("spring 注册对象列表" + BeanFactory.listBeans());
          
          UserController userctl =  (UserController) BeanFactory.getBean(UserController.class);
          userctl.list(); 
	   }
}
